package net.gyapp.markim.core.entity;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToMany;

import java.io.Serializable;
import java.util.List;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;
import net.gyapp.markim.dao.DaoSession;
import net.gyapp.markim.dao.MessageEntityDao;
import net.gyapp.markim.dao.ConversationEntityDao;

/**
 * Auther:  winds
 * Email:   heardown@163.com
 * Date:    2018/7/19.
 * Desc:
 */
@Entity
public class ConversationEntity implements IEntity, Serializable {

    private static final long serialVersionUID = -7804074649391975045L;
    @Id
    public Long id; //主键

    public Long userId;    //外键 关联用户

    public String sessionIdStr;   //会话id  当群聊时为 群组ID  groupId  若为私聊时为 用户id
    public int chatType;    //聊天类型
    public String name;     //会话名称 //群名称 或者 好友昵称（无昵称 显示id） 或者remark
    public String avatar;   //会话头像  //群头像 或者 好友头像
    public int unReadNum; //未读数量

    public Long latestTime; //最近的消息时间
    public String latestMsg;    //最近的消息
    public int latestMsgType;    //最近的消息类型
    public String latestNick;    //最近的消息发布人昵称
    public String latestAvatar;    //最近的消息发布人头像
    public String latestName;    //最近的消息发布人名称
    public String latestRemark;    //最近的消息发布人备注

    public String extra1;  //扩展字段1
    public String extra2;  //扩展字段2
    public String extra3;  //扩展字段3

    @Generated(hash = 1302088386)
    public ConversationEntity(Long id, Long userId, String sessionIdStr,
            int chatType, String name, String avatar, int unReadNum,
            Long latestTime, String latestMsg, int latestMsgType, String latestNick,
            String latestAvatar, String latestName, String latestRemark,
            String extra1, String extra2, String extra3) {
        this.id = id;
        this.userId = userId;
        this.sessionIdStr = sessionIdStr;
        this.chatType = chatType;
        this.name = name;
        this.avatar = avatar;
        this.unReadNum = unReadNum;
        this.latestTime = latestTime;
        this.latestMsg = latestMsg;
        this.latestMsgType = latestMsgType;
        this.latestNick = latestNick;
        this.latestAvatar = latestAvatar;
        this.latestName = latestName;
        this.latestRemark = latestRemark;
        this.extra1 = extra1;
        this.extra2 = extra2;
        this.extra3 = extra3;
    }

    @Generated(hash = 2044044276)
    public ConversationEntity() {
    }

    @Override
    public String toString() {
        return "ConversationEntity{" +
                "id=" + id +
                ", userId=" + userId +
                ", sessionIdStr='" + sessionIdStr + '\'' +
                ", chatType=" + chatType +
                ", name='" + name + '\'' +
                ", avatar='" + avatar + '\'' +
                ", unReadNum=" + unReadNum +
                ", latestTime=" + latestTime +
                ", latestMsg='" + latestMsg + '\'' +
                ", latestMsgType=" + latestMsgType +
                ", latestNick='" + latestNick + '\'' +
                ", latestAvatar='" + latestAvatar + '\'' +
                ", latestName='" + latestName + '\'' +
                ", latestRemark='" + latestRemark + '\'' +
                ", extra1='" + extra1 + '\'' +
                ", extra2='" + extra2 + '\'' +
                ", extra3='" + extra3 + '\'' +
                '}';
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return this.userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getSessionIdStr() {
        return this.sessionIdStr;
    }

    public void setSessionIdStr(String sessionIdStr) {
        this.sessionIdStr = sessionIdStr;
    }

    public int getChatType() {
        return this.chatType;
    }

    public void setChatType(int chatType) {
        this.chatType = chatType;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAvatar() {
        return this.avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public int getUnReadNum() {
        return this.unReadNum;
    }

    public void setUnReadNum(int unReadNum) {
        this.unReadNum = unReadNum;
    }

    public Long getLatestTime() {
        return this.latestTime;
    }

    public void setLatestTime(Long latestTime) {
        this.latestTime = latestTime;
    }

    public String getLatestMsg() {
        return this.latestMsg;
    }

    public void setLatestMsg(String latestMsg) {
        this.latestMsg = latestMsg;
    }

    public int getLatestMsgType() {
        return this.latestMsgType;
    }

    public void setLatestMsgType(int latestMsgType) {
        this.latestMsgType = latestMsgType;
    }

    public String getLatestNick() {
        return this.latestNick;
    }

    public void setLatestNick(String latestNick) {
        this.latestNick = latestNick;
    }

    public String getLatestAvatar() {
        return this.latestAvatar;
    }

    public void setLatestAvatar(String latestAvatar) {
        this.latestAvatar = latestAvatar;
    }

    public String getLatestName() {
        return this.latestName;
    }

    public void setLatestName(String latestName) {
        this.latestName = latestName;
    }

    public String getLatestRemark() {
        return this.latestRemark;
    }

    public void setLatestRemark(String latestRemark) {
        this.latestRemark = latestRemark;
    }

    public String getExtra1() {
        return this.extra1;
    }

    public void setExtra1(String extra1) {
        this.extra1 = extra1;
    }

    public String getExtra2() {
        return this.extra2;
    }

    public void setExtra2(String extra2) {
        this.extra2 = extra2;
    }

    public String getExtra3() {
        return this.extra3;
    }

    public void setExtra3(String extra3) {
        this.extra3 = extra3;
    }
}
